package com.bw.jetpacktest.navigartion.show;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.navigation.NavController;
import androidx.navigation.NavHostController;
import androidx.navigation.fragment.NavHostFragment;
import androidx.navigation.ui.NavigationUI;

import com.bw.jetpacktest.R;
import com.google.android.material.bottomnavigation.BottomNavigationView;

public class ShowActivity extends AppCompatActivity {

    private BottomNavigationView show_bottom_view;
    private NavHostFragment show_nav_fragment;
    private NavController controller;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_show);
        init();
    }

    private void init(){
        show_bottom_view = findViewById(R.id.show_bottom_view);
        show_nav_fragment = (NavHostFragment) getSupportFragmentManager()
                .findFragmentById(R.id.show_nav_fragment);
        controller =  show_nav_fragment.getNavController();
        ShowNavigator showNavigator = new ShowNavigator(this,
                getSupportFragmentManager(),
                show_nav_fragment.getId());
        controller.getNavigatorProvider().addNavigator(showNavigator);
        controller.setGraph(R.navigation.show_navigation);
        NavigationUI.setupWithNavController(show_bottom_view,controller);
    }

}
